use serde::{Deserialize, Serialize};

// 通用API响应结构
#[derive(Debug, Serialize, Deserialize)]
pub struct ApiResponse<T> {
    pub data: Option<T>,
    pub msg: String,
    pub status: i32,
    pub code: i32,
}

// 用户实体
#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct User {
    pub id: String,
    pub username: String,
    pub nickname: Option<String>,
    pub avatar_url: Option<String>,
    pub roles: Option<Vec<String>>,
    pub token: String,
}

// 登录请求
#[derive(Debug, Deserialize, Serialize)]
pub struct LoginRequest {
    pub username: String,
    pub password: String,
}

// 注册请求
#[derive(Debug, Deserialize, Serialize)]
pub struct RegisterRequest {
    pub username: String,
    pub email: String,
    pub password: String,
}

// 认证响应
#[derive(Debug, Serialize)]
pub struct AuthResponse {
    pub data: Option<User>,
    pub msg: Option<String>,
    pub status: bool,
    pub code: i32,
}

// 登录API响应（兼容旧格式）
#[derive(Debug, Deserialize)]
pub struct LoginApiResponse {
    pub data: Option<serde_json::Value>,
    pub msg: String,
    pub status: bool,
    pub code: i32,
}

// 文件上传数据
#[derive(Debug, Serialize, Deserialize)]
pub struct UploadData {
    pub url: String,
    pub name: String,
    pub ext: String,
}

// 地理位置点
#[derive(Debug, Serialize, Deserialize)]
pub struct Location {
    pub latitude: f64,
    pub longitude: f64,
}

// 钓鱼圈保存请求
#[derive(Debug, Serialize, Deserialize)]
pub struct FishingCircleRequest {
    pub title: String,
    pub latitude: f64,
    pub longitude: f64,
    pub points: Vec<Location>,
    pub pics: Vec<String>,
    pub area: f64,
    pub description: Option<String>,
}
